package org.github.manx98.jlibhac.util;

import java.nio.charset.StandardCharsets;

/**
 * @author Manx98
 * @version 1.0
 * @since 2022/10/5 22:18
 */
public class StringUtil {
    public static String utf8ZToString(byte[] data, int start, int end) {
        return new String(data, start, getLength(data, start, end), StandardCharsets.UTF_8);
    }

    public static int getLength(byte[] s, int start, int end) {
        int i = 0;

        while (i < end && s[start + i] != 0) {
            i++;
        }

        return i;
    }
}
